local key = KEYS[1]
local time = ARGV[1]
local max_count = tonumber(ARGV[2])
local curCount = redis.call('INCR', key)
if curCount == 1 then
    redis.call('EXPIRE',key, time)
end
if curCount > max_count then
    return 0
end
return 1
